Method and apparatus for bit rate control in a digital video environment for arbitrary bandwidth

ABSTRACT

According to an embodiment of the present invention, a method is presented for controlling a video image compression system. In this method a video frame of raw video image data is compressed using a processor. Then it is determined whether the processor is limited in its ability to compress video image data. Then, a target frame rate is adjusted based on a current amount of time taken to compress said video frame of raw video image data.

RELATED APPLICATIONS

The present application is a continuation-in-part of U.S. Ser. No.08/773,043 filed on Dec. 24, 1996 now U.S. Pat. No. 6,263,020 thedisclosure of which is hereby incorporated by reference.

FIELD OF THE INVENTION

The present invention pertains to a method and apparatus for thecompression and transmission of video data. More particularly, thepresent invention pertains to controlling bit rate in a digital videocompressor environment coupled to a transmission medium with anarbitrary or varying bandwidth.

BACKGROUND OF THE INVENTION

A video compression/transmission system that is known in the art isshown in FIG. 1. A camera 11 is provided that generates video image datafor a video capture component 13. The video capture component 13“captures” the video image data from the camera one frame at a time in aknown manner and at a predetermined rate (e.g., approximately 30 framesper second). The video capture component 13 transfers the video framedata to a video compressor 15 which may compress the video image datafor the frame according to a bit-rate control algorithm. Such a bit-ratecontrol algorithm typically includes a compression algorithm such as anyof a variety of block transform based video transform algorithms such asH.261 (International Telecommunication Union-TelecommunicationsStandardization Sector (ITU-T), March, 1993), H.263 (ITU-T, Dec. 5,1995), JPEG (“Joint Photographic Expert Group”)(InternationalOrganization for Standardization/International ElectrotechnicalCommission (“ISO/IEC”) 10918-1), MPEG-I, and MPEG-II (“Motion PictureExpert Group”)(ISO/IEC 11172-2 and 138182). The compressed video framedata is then sent to a transmitter 19 via a video controller 17, and thedata is stored temporarily in a transmit buffer 20 under the control ofa buffer regulator. The transmitter 19 then pulls data from the transmitbuffer sequentially and adds the appropriate protocol information andtransmits the data to a transmission medium (e.g., POTS (Plain OldTelephone Service) in a modem-to-modem connection).

In some systems, such as some ProShare® systems and Intel Smart VideoRecorders® systems (Intel Corporation, Santa Clara, Calif.), the bitrate control algorithm of compressor 15 operates separately from thetransfer of data from the transmit buffer 20 to the transmission medium21 by the buffer regulator. Because of this separation, the operation ofthe bit rate control algorithm can only estimate the state of thetransmit buffer 20 (i.e., how much data is contained in the transmitbuffer 20). Also, the buffer regulator of the transmitter 19 typicallyrequires that the video compressor 15 produce the same amount ofcompressed data for each frame. This separation of the components leadsto inaccuracies in that the transmit buffer 20 is incorrectly filled(i.e., not filled with enough data which reduces the frame rate over thetransmission medium or filled with too much data causing delay orlatency).

In some systems, the transmission rate can vary widely (e.g., over ahigh speed connection to a network such as the Internet). For example,in one video-phone application, the bandwidth of the transmission mediummay be changed by the user's “on-the-fly” during the communication. Withsuch varying transmission rates, there exists additional problems inprocessor utilization to adequately compress frames of video data. Thisis due to the fact that the transmission medium may at times be able toprovide more resources than can be adequately or efficiently used by theprocessor system.

In view of the above, there is a need for a system and method thatimproves processor utilization in handling transmission of video framedata.

SUMMARY OF THE INVENTION

According to an embodiment of the present invention, a method ispresented for controlling a video image compression system. In thismethod a video frame of raw video image data is compressed using aprocessor. Then it is determined whether the processor is limited in itsability to compress video image data. Then, a target frame rate isadjusted based on a current amount of time taken to compress said videoframe of raw video image data.

BRIEF DESCRIPTION OF THE INVENTION

FIG. 1 is a block diagram of video compression and transmission systemthat is known in the art.

FIG. 2 is a block diagram of a video compression and transmission systemoperated according to an embodiment of the present invention.

FIG. 3 is block diagram of a video controller and video compressorsystem operated according to an embodiment of the present invention.

FIG. 4 is a flow diagram of an operation of a quantizer selector.

FIG. 5 is a flow diagram of an operation of a buffer regulator.

FIG. 6 is a flow diagram of an improved operation of the videocompression system according to an embodiment of the present invention.

DETAILED DESCRIPTION

Referring to FIG. 2, a block diagram of an embodiment of a videocompression and transmission system 30 of the present invention isshown. In this example, the bit rate controller can include a bufferregulator 34 (in a video controller 35) and a quantizer selector 36 (ina video compressor 37). As in FIG. 1, a camera 31 is provided whichsupplies video image data to a video capture component 33. The videocapture component is capable of supplying video image data at a rate ofapproximately 30 or 60 frames per second (FPS) to the video controller35. As is known in the art, the video controller 35 may issue a“callback” (e.g., via the operation of a video capture driver) to thevideo compressor 37 to notify that component that a video frame is readyto be compressed. The video controller 35, via the buffer regulator 34,schedules the compression of video image data from the video capturecomponent 33 by supplying it to a video compressor 37. The videocompressor 37 then compresses the video image data under the control ofthe quantizer selector 36. The compressed video image data is thensupplied by the video controller 35 to a transmitter module 39 which maystore this data in a transmit buffer 40. Compressed video data is thenpulled from the transmit buffer 40 and sent to a transmission medium 41such as a Plain Old Telephone Service (POTS). The transmission mediumalso includes high-speed connections such as high-speed Internetconnections such as digital subscriber lines and cable modem connections

Using POTS, the bandwidth of the phone lines is limited to approximately25-28 kilobits per second (kbps). Using high speed connections, thebandwidth is increased dramatically to 200 to 300 kbps. Due tolimitations in the bandwidth of the POTS transmission medium, videoimage data is most often transmitted at less than the video capture rateof 30 FPS. With a higher-speed transmission medium, a 30 FPS rate ispossible, but may not be achievable due to processor limitations.Accordingly, it is possible that not every frame of video image datagenerated by the video capture component 33 is compressed by the videocompressor 37 (i.e., not every frame of video image data may bescheduled to be compressed by the video controller 35). According to anembodiment of the present invention, the system 30 attempts to operateat a target frame rate (i.e., the number of frames of compressed videoimage data sent over the transmission medium each second) and a targetbit rate (i.e., the number of bits per second that are processed by thesystem 30). For this example, it is assumed, at least initially, thatthe target frame rate for the system 30 is 30 FPS (with a high-speedtransmission medium). A target frame size is calculated as the expectedbandwidth of the transmission medium (which is related to the target bitrate and may be set by the user) divided by the target frame rate. Underthe control of the bit rate controller 36, the video compressor 37 willattempt to compress video frame data from the video capture component 33to the target frame size. The compressed video data is then sent by thevideo controller 35 to the transmitter module 39 and placed in thetransmit buffer 40. The quantity of data contained in the transmitbuffer 40 (e.g., measured in bits or bytes) is supplied to the videocontroller 35 as a value, such as an outstanding byte (OB) value. If,for example, the entire transmission medium is not a directmodem-to-modem connection, it is likely that the transmitter module 39will not be able to provide an exact value for OB. This can be estimatedbased on the transmission rate as described in further detail below. Thebit rate controller 36 compares the OB value to a threshold value or“Low Water Mark” and schedules another frame of video data from thevideo capture component 33 to be compressed by the video compressor 37when OB is less than the threshold value. The Low Water Mark may befirst multiplied by a Low Water Mark Adjustment value which may bepreset to the value 1. The low water mark value should be high enough sothat by the time all of the remaining bits have been drained from thetransmit buffer 40, the video compressor 37 will have finishedcompressing the next frame and is ready to place it in the transmitbuffer 40.

If the transmitter module 39 is transmitting compressed video data fromthe transmit buffer 40 to the transmission medium 41 at the target bitrate, and the video compressor 37 is returning compressed video frameshaving a target frame size, then the target frame rate will be achieved.However, the transmission bandwidth can vary (e.g., when requested bythe user) and the video compressor may be able to generate compressedvideo frames that contain approximately the target frame size. The videocontroller 35 may detect that the transmit buffer is being drained at arate different than originally specified over an extended period oftime, then the video compression and transmission system 30 canrecalculate a target frame size based on the new transmission bandwidthto maintain the same frame rate (or pick a new frame rate), and can varythe low water mark to minimize latency.

The operation of the video compressor 37 will be described withreference to FIG. 3. When compressing raw video data of a frame, thevideo controller 35 (via the buffer regulator) calculates the targetframe size (i.e., target number of bits per frame) that corresponds tothe target frame rate and the expected bandwidth. Calculation of thetarget frame size will be shown in more detail below. The videocompressor 37 includes a coder/decoder (codec) 53 which employs a bitrate control algorithm on a per-frame basis to attempt to achieve thetarget bit rate. Compression algorithms such as H.263, require that rawvideo data be divided into a plurality of rows of macroblocks. Eachmacroblock is of the same size (e.g., in the H.263, each macroblock hasa size of 16 by 16 pixels).

The quantizer selector 36 includes a processor 50 that receives thetarget frame size from the video controller 35 as well as commandinformation (e.g., to schedule a frame compression). When the videocontroller 35 schedules a frame to be compressed, it is sent to thevideo compressor 37 and can be stored in an uncompressed data queue 54.The data in queue 54 is sent to the codec 53 which compresses the videoframe data under the control of the bit rate controller 50. Part of thatcontrol is the providing of a quantization parameter (newQP) to thecodec 53.

The Quantization Parameter (QP) value in a hybrid Discrete CosineTransform (DCT) compression algorithm can vary between a low value of 0and a high value of 31 according to the H.263 specification. After theDCT is completed, the transformed coefficients are quantized with the QPvalue. How many bits are needed to transmit the quantized coefficientsfor a macroblock depends on the value of the QP. When the QP value issmall, a large number of bits are usually needed. When the QP value islarge, fewer bits are needed. Accordingly, the QP value has an inverseproportional effect on the number of compressed bits generated for eachmacroblock.

In this compression algorithm, it is assumed that consecutive frames ina video sequence will have similarities (e.g., similar backgrounds) andwill have similar bit usage distributions. A goal of the compressionalgorithm is to match the bit usage distribution in the current framewith the previous frame. To avoid rapid fluctuations, and to handlescene changes, certain limitations will be applied. It is assumed thatthere are N macroblocks in a frame. Prior to encoding macroblock n of N,the following calculations are performed to determine the value for QPto be used when encoding the nth macroblock. A flow diagram showing anexample of a method for setting the value for newQP is shown in FIG. 4.First, the target frame size is determined as discussed in more detailbelow. Also, the number of bits that should have been used up inencoding the first n macroblocks is calculated as follows (block 100):

bit_usage_target=(prev_bit_usage[n]/prev_bit_usage[N])*target_frame_rate  Eq.1

where bit_usage_target is a target value for the number of bits thathave already been created for the current compressed frame (i.e., afterencoding the first n-1 macroblocks), prev_bit_usage[n] is the cumulativenumber of bits used in the first n-1 macroblocks of the previouscompressed frame, and prev_bit_usage[N] is the total number of bits usedin the previous compressed frame. The previous bit usage array can bestored in a memory 51 in the bit rate controller 36.

As suggested in Video Codec Test Model, TMN5 (ITU-T, Study Group 15,Working Party 15/1, Expert's Group on Very Low Bitrate Visual Telephony(Jan. 31, 1995), the disclosure of which is hereby incorporated byreference in its entirety), the value for the first version of the QPvalue is selected according to Equations 2-5.

bit_usage_delta=bit_usage_until_now−bit_usage_target  Eq. 2

(block 102) where bit_usage_until_now is the total number of bits thathave been used to compress the current frame up to the currentmacroblock. This value can be supplied by a compressed data queue 52coupled to the output of the codec 53.

 local_adj=12.0*bit_usage_delta/(target_frame_size*target_frame_rate)  Eq.3

global_adj=(prev_bit_usage[N]−target_frame_size)/(2.0*target_frame_size)  Eq.4

newQP=meanQP_for_previous_picture*(1+global_adj+local_adj)+0.5  Eq. 5

(block 104). The quantization parameter for the nth macroblock has avalue between 0 and 31 according to the H.263 specification. The meanvalue for QP for the previous picture (frame) can also be stored inmemory 51 of the bit rate controller 36.

The quantization parameter is changed so as to control the size of thevideo frame data and the amount the quantization parameter can fluctuateis controlled to prevent degradations in quality. The quantizationparameter can be controlled so that it is held between an upper and alower limit for each row of macroblocks. For example, if the value fornewQP, calculated above is greater than a selected term, A (see decisionblock 107), then newQP is set to A (block 108). Also, if newQP is lessthan a second selected value, B (see decision block 111), then newQP isset to B (block 112). The value for A can be selected based on theprevious value for QP as shown in equations 6-9 (block 106).

QP=1→2: A=mean_(—) QP_for_previous_row_of_macroblocks+1  Eq. 6

QP=3→4: A=mean_(—) QP_for_previous_row_of_macroblocks+2  Eq. 7

QP=5→23: A=mean_(—) QP_for_previous_row_of_macroblocks+3  Eq. 8

QP=24→31: A=mean_(—) QP_for_previous_row_of_macroblocks+4  Eq. 9

The value for B can be selected based on equation 10 (block 110):

B=mean_(—) QP_for previous_row_of_macroblocks−2  Eq. 10

In this example, using equations 6-10, the quantization parameter isprevented from increasing more than four quantization values over onerow of macroblocks and is prevented from decreasing more than twoquantization values over a row of macroblocks (as compared to the meanquantization parameter value for the previous row of macroblocks). Thus,large fluctuations in the QP value are reduced in the video framecurrently being compressed, which would degrade quality. By controllingthe quantization parameter in such a manner, the overall system reactsmore quickly to changes in complexity in the video sequence andallocates bits more accurately to different parts of the video frameaccording to a past history of bit allocation. As with other valuesdescribed above, mean QP values for previous rows of macroblocks can bestored in memory 51 of the bit rate controller 36.

The value for newQP can be set to a selected value C (block 116), ifnewQP is less than C (decision block 115), where

C=⅔*startQP  Eq. 11

(block 114) where startQP is the QP for the first macroblock calculatedas:

startQP=meanQP_for_previous_picture*(1+global_adj)+0.5  Eq. 12

Limiting the value of newQP so that it never decreases below ⅔ of theaverage of all quantization parameters for the previous frame preventsan excessively large frame size (e.g., having a number of compressedbytes far in excess of the target frame size) and large fluctuations inthe QP value from video frame to video frame which can also degradequality.

It may be important that the bit count for the frame currently beingcompressed does not appreciably exceed the target frame size. If itdoes, then there is a possibility that the transmit buffer 40 (storingbuffer_size bits) will overflow resulting in lost video frame data.Accordingly, if bit_usage_until_now>(n/N)*D*buffer_size, then newQP isset to the selected value of E.

In this example, E is newQP+4 and D is .0.75.

The target frame size in kbits can be changed to compensate for theability of the video system to fill the bandwidth of the transmissionmedium 41. Prior to sending a frame of compressed data to thetransmitter module 39 (or after a number of compressed frames are sent),the OB value can be estimated.

Whether the compressor 37 is to compress a video frame from the videocapture component 33 can be based on a comparison between the OB valuefrom the transmitter 37 and the threshold value or “low water mark.” Thelow water mark is just high enough so that by the time all remainingbits have been drained from the transmit buffer 40, the video compressor37 will have finished compressing the next frame and is ready to placeit in the transmit buffer 40. If the low water mark is too low, thebuffer will be empty for some period of time before the next frame isfinished compressing, and thus the bandwidth over the transmissionmedium 41 will be wasted. On the other hand, if it is too high, then thenext frame of video will have sat in the transmit buffer 40 longer thannecessary and thus latency would be added to the system 30.

To compute an initial value for the threshold value (Low Water Mark orLWM), two values could be used. The first is the amount of time leftbefore the video compressor 37 would be able to compress a raw videoframe from the video capture component 33 if it did not compress the onecurrently available from the component 33 (i.e., the next send time(NST)). Since the amount of time varies for compressing an image anestimate can be used that is 20% greater than the average of the last ycompressions. Accordingly, for a compress time (CT_(i)) for the ithframe, the current compress time (CCT) at the ith frame would be:

CCT ₁=(CT _(i−y+1) + . . . +CT _(i−1) +CT _(i))/y  Eq. 13

If VCI is the video capture interval for the video capture component 33(e.g., 1/29.97 fps or 33.37 ms) the estimate for the next sample time iscomputed as:

NST=VCI+1.2*CCT  Eq. 14

It can be seen from the above, that the rate at which video frames arecaptured by the video capture component 33 has an effect on latency inthe system 30. Thus, the faster that video frames are captured, the lesstime the video compressor 37 will be waiting for a raw video frame datafrom the video capture component 33.

The second value is the current byte rate (CBR) which is the rate atwhich bytes of compressed data are being read from the transmit buffer40. The CBR after the ith frame is computed as an average of the last zframes sent as:

CBR _(i)=(L _(i−z+1)/(T _(i−z+1) −T _(i−z))+ . . . +L _(i−1)/(T _(i−1)−T _(i−2))+L _(i)/(T _(i) −T _(i−1)))/z  Eq. 15

where L_(i) is the length in bytes of the ith compressed frame of videodata and T_(i) is a time stamp (in elapsed milliseconds) associated withframe i. Given these two values, the selection of a value for the lowwater mark threshold is:

LWM=NST*CBR  Eq. 16

as system parameters change, such as transmission medium bandwidth andtarget frame rate, the LWM threshold may be changed to compensate forit. The LWM threshold can be adjusted after each frame (or after a setnumber of frames) by multiplying it with and LWM adjustment (LWMadj)which would have an initial value of 1.

The buffer regulator 34 can also be used in controlling the generationof so-called PB-frames using the low water mark threshold. As detailedin the H.263 specification, a PB frame includes one P-frame which ispredicted from the previously decoded P-frame and one B-frame which ispredicted both from the previous decoded P-frame and the P-framecurrently being decoded (thus, bidirectionally). If a B-frame isexpected at the current compression time, that compression can bescheduled even if the OB value is above the LWM threshold. This isbecause, even if the B-frame is compressed, it is not sent immediately(i.e., like a P-frame) since the encoder holds on to it and returns itwith the appropriate P-frame as a PB-frame.

The operation of the bit rate controller 36 as it relates to the lowwater mark threshold and the target frame size is shown in FIG. 5 inflow diagram form. In block 61, the low water mark threshold is computedand adjusted as described herein. If a B-frame is expected in decisionblock 63 control passes to block 67 where the next frame of video datais queued for compression (e.g., in queue 54 of FIG. 3). If a B-frame isnot expected, then the OB (Byte Count) value is checked against the lowwater mark threshold (decision block 63) and the compression is skippedif the OB value is too high (block 65). Otherwise, if the videocompressor 37 is not busy (decision block 66), then the video frame datais queued for compression (block 67). In block: 71, the targetframe_size variable is adjusted as described herein and the video framedata is compressed by codec 53 (block 73). In block 75 the CCT and CBRvalue are updated and the OB value is once again checked in decisionblock 77. If the OB value is 0 then the LWMadj and TFSadj values aredecreased (block 79), and if the OB value is not 0, the same variablesare increased (block 78). In block 80, the compressed frame data is sentto the transmit buffer 40 via the video controller 35 and controlreturns to block 61 to handle the next frame of video data.

With the video compression/transmission system described above, animproved quality of video data is achieved in that the system adaptsquickly to changing bandwidth at the transmission medium 41. If thetransmit buffer is being drained at a rate that is different thanoriginally specified over an extended period of time, then the videocontroller 35 can recalculate the target frame size based on the newtransmission bandwidth to maintain the same frame rate, and can vary the“low water mark” threshold to minimize latency. Though this system workswell with a bandwidth that moderately changes (e.g., in a modem-to-modemconnection), there are some problems associated with widely varyingbandwidths (e.g., as provided in high-speed Internet connections).

An embodiment of an improved method for controlling the videocompression system of FIG. 2 is shown in FIG. 6. In block 1, a frame iscompressed using a video compressor and a block-transform basedcompression algorithm. In this embodiment of the present invention, whenthe video capture device has captured a video frame, it alerts the videocompressor such as through a “call back” operation, alerting the videocompressor to the availability of raw video data for compression. Inblock 2 a new target frame rate (TFR) is computed based on the processorusage, as described below. In this embodiment, processor usage isdetermined by comparing the amount of time taken to compress the currentvideo frame (“CurrentCompressTime”) to the target frame period(“MaxTimePerFrame”). The target frame period is equal to the inverse ofthe target frame rate. In this example, the determination is summarizedin Eq. 17:

ABS(CurrentCompressTime−MaxTimePerFrame)>MaxTimePerFrame/5  Eq. 17

Thus, it is determined if the difference between these two values isgreater than 20% of the MaxTimePerFrame. If it is, then it is determinedwhether CurrentCompressTime is less than MaxTimePerFrame. If theCurrentCompressTime is greater than the MaxTimePerFrame, then it isassumed that the processor is limited in its ability to compress videodata (i.e., the processor cannot compress frames fast enough for thecurrent target frame rate). To compensate, the target frame rate isreset based on the CurrentCompressTime.

In this example, the CurrentCompressTime can have a value between 0 and1000 milliseconds (ms). If the CurrentCompressTime is between 0 and 33ms then the target rate is set to 33 and the MPI (minimum pictureinterval) is set to one. This continues in a like fashion for ranges ofthe CurrentCompressTime (e.g., 33 to 66 ms, 66 to 100 ms, . . . 967 to1000 ms) and can be summarized by Eq. 18:

New MPI=int((30×CurrentCompressTime)/1000+1)  Eq. 18

and the new Target Frame Period is calculated as follows:

TFP=(1000×New MPI)/30  Eq. 19

According to an embodiment of the present invention, the whole numbervalue of New MPI is used as a divisor into the frame rate of the videocapture device (which is 30 frames per second) to calculate a new TargetFrame Rate. As seen in this example, the whole number value for New MPIis in the range 1 to 30. Accordingly, the rate at which frames arepresented to the video compressor (i.e., the target frame rate) is resetto 30/(int(New MPI)) according to this embodiment of the presentinvention. This leads to a smoother video presentation because frameswill be taken for compression at more regular intervals than wouldotherwise be available. For example, if int (New MPI) has the valuethree, then every third frame from the video capture device would bepresented to the video compressor for compression (e.g., through a callback operation by the video capture driver).

Referring back to FIG. 6, after the new Target Frame Rate has beencalculated, control passes to decision block 3 where it is determinedwhether the outstanding byte count (OB) (i.e., the number of bytes to besent to the transmission module is equal to 0. The OB value isestimated, in this embodiment, as follows. First, a variable DBR is setto the desired byte rate. In this case the desired byte rate is relatedto the desired transmission rate. The estimate for the OB value is basedon the timing of information. For example, t(m) is a timestamp (e.g.,date, hours, minutes, seconds or a value from a free flowing counter)for the mth time a call or request is made to obtain the OB value. Everytime a frame is sent, the OB value is recalculated as follows:

OB=OB+fsize(i)  Eq. 20

where i represents the number of the frame (i.e., the ith frame). Everytime a call is made to get the OB value (e.g., during the execution of aroutine by the processor), the OB value is then calculated using thefollowing equation:

OB=OB−(t(m)−t(m−1))*DBR  Eq. 21

where DBR=the desired bit rate (i.e., the rate at which bits aretransferred from the transmitter to the transmission medium). Inequation 21, it is seen that the previous value for OB would be thevalue at time t(m−1). Based on the calculation of OB, if OB is 0 thencontrol passes to decision block 5. In decision block 5, the methodseeks to take steps to prevent the OB count value from going to zero.First the LWM value is adjusted by increasing it by a certain percentage(e.g., 1% or 0.01). If desired, this predetermined multiplier value maybe stored as “LWM Adjustment” and increased by a certain percentage eachtime control reaches block 5. Additionally, a maximum value for LWMAdjustment may be set (e.g., 1.5 or 2.0). As stated above, the LWM valueaffects the scheduling of frames for compression, thus if the LWM is sethigher, then requests for a frame to be compressed is made with a higherOB count with the goal that the frame will be compressed before the OBcount value goes to 0.

Also as part of block 5, it is determined whether the frame size isclose (FSC) to optimal. In this example, the boolean value for FSC willbe true (e.g., a binary “1”) if Equation 22 is true:

abs(AFS−TFS)<TFS/10  Eq. 22

Thus, in Eq. F, FSC will be true if the absolute value of the differencebetween the Average Frame Size (AFS) and the Target Frame Size (TFS) isless than 10% of the Target Frame Size. It is also determined if theframe rate is close (FRC) to optimal. In the example, the boolean valuefor FRC will be true (e.g., binary “1”) if Equation 23 is true:

AFP<110% of TFP  Eq. 23

Thus, in Eq. 23, FRC will be true if the Average Frame Period (i.e., theinverse of the Average Frame Rate) is less than 110% of the Target FramePeriod (e.g., the inverse of the Target Frame Rate). It is alsodetermined whether the previous callback was skipped because thecompressor was busy. This is represented, in this example, by the valueNeedBiggerFrames and is defined by the following equation in thisexample:

NeedBiggerFrames=CompressingOnPreviousCB OR CompressedPrevCB  Eq. 24

CompressingOnPreviousCB is true if the compressor skipped the previouscallback because the compressor was busy (since OB is zero when theframe is sent, meaning that it takes longer to compress a frame than itdoes to send it). What occurred here was that a frame was scheduled forcompression and while the compressor was compressing it, another framewas available for compression but this “previous compression” callbackhad to be skipped because the compressor was busy. CompressedPrevCB istrue if the frame was scheduled for compression for the previouscallback. What occured here is that a frame was scheduled forcompression and was successfully compressed (since OB is zero when thecompressed frame was ready to be transmitted, the target frame size istoo small for the video capture interval).

Returning to block 5 the following equation is determined:

FSC AND (FRC OR NeedBiggerFrames)  Eq. 25

If Equation 25 is true then control passes to block 9 where the targetbit rate (TBR) is increased (e.g., by 2.5%), if the TFR were not changedin block 2, this would lead to an increase in the target frame size.Otherwise, control passes to block 13 where the compressed frame is sentto the transmission module for sending out over the transmission medium.

If the OB value is not 0 when the frame is ready to send (decision block3), then control passes to block 7. In block 7 it is first determinedwhether the OB value exceeds a certain threshold (in this case, 12.5% ofthe Target Frame Size). If the OB value is less than 12.5% of the TargetFrame Size, then there should be no adjustment of the Target Bit Rate soas to avoid what may become excessive corrections of a bit rate that isacceptable under the current operating circumstances. As part of block7, if the OB value exceeds the threshold, then theLowWaterMarkAdjustment value is decreased by a predetermined value(e.g., 0.001) and then multipled by the LWM value for future schedulingcomparisons. Next it is determined whether the target frame rate isbeing achieved by first determining whether the Current Frame Period isa certain threshold greater the Target Frame Period (TFP). In thisexample it is determined whether the Current Frame Period is 5% greaterthan the Target Frame Period. Whether to adjust the Target Frame Size isdetermined based on whether Eq. 26 is true, namely:

(OB>TFS/8) AND (CurrentFramePeriod>(1.05*TFP)) AND NOT(FRC) ANDNOT(NeedBiggerFrames)  Eq. 26

In this embodiment, if all four of these values are true, then thetarget bit rate is modified in block 11 by decreasing it by a givenvalue (e.g., 2.5%). In either case control passes to block 13 where thecompressed frame is sent to the transmission module for sending out overthe transmission medium.

Using the method and system of the present invention an improved bitrate control can be achieved, especially at high bit rates. The targetframe rate and target bit rate are effectively monitored and updatedbased on processor usage. This leads to the advantage of modifying thebit rate of the compression system while at the same time achieving aspecific frame rate and more uniformly spaced frames giving theimpression of smoother, or less choppy, motion in the video output.

Although several embodiments are specifically illustrated and describedherein, it will be appreciated that modifications and variations of thepresent invention are covered by the above teachings and within thepurview of the appended claims without departing from the spirit andintended scope of the invention.

What is claimed is:
 1. A method for controlling a video imagecompression system, comprising: compressing a video frame of raw videoimage data; determining a target frame size based on a target bit ratefor said video image compression system; determining an outstanding bytecount value related to a number of bytes of compressed video image datato be transmitted from said video image compression system; comparing acurrent frame size with said target frame size; and adjusting the targetbit rate for said video image compression based on said comparison. 2.The method of claim 1 wherein in said adjusting, the target bit rate isadjusted if the outstanding byte count is zero and the current framesize is within a predetermined tolerance from said target frame size. 3.The method of claim 1 wherein in said adjusting step, the target bitrate is adjusted if the current frame size is within a predeterminedtolerance from said target frame size and at least one of a currentframe rate is within a predetermined tolerance from said target framerate and the ability of the processor to compress video frames to thetarget frame size at a target frame rate.
 4. A method of controlling avideo image compression system comprising: compressing a video frame ofraw video image data; determining a target frame size based on a targetbit rate for said video image compression system; determining anoutstanding byte count value related to a number of bytes of compressedvideo image data to be transmitted from said video image compressionsystem; comparing a current frame size with said target frame size;comparing an average frame rate for the video image compression systemto a target frame rate for the video image compression system; andadjusting the target bit rate for said video image compression based onsaid comparisons.
 5. The method of claim 4 wherein in said adjusting,the target bit rate is adjusted if the outstanding byte count is greaterthan zero and the current frame size is within a predetermined tolerancefrom said target frame size.
 6. The method of claim 4 wherein in saidadjusting, the target bit rate is adjusted if the current frame size iswithin a predetermined tolerance from said target frame size and atleast one of a current frame rate is not within a predeterminedtolerance from said target frame rate and the ability of the processorto compress video frames to the target frame size at a target framerate.
 7. A set of instructions residing in a storage medium, said set ofinstructions capable of being executed by a processor to implement amethod for controlling a video image compression system, the methodcomprising: compressing a video frame of raw video image data;determining a target frame size based on a target bit rate for saidvideo image compression system; determining an outstanding byte countvalue related to a number of bytes of compressed video image data to betransmitted from said video image compression system; comparing acurrent frame size with said target frame size; and adjusting the targetbit rate for said video image compression based on said comparison. 8.The set of instructions of claim 7 wherein in said adjusting step, thetarget bit rate is adjusted if the outstanding byte count is zero andthe current frame size is within a predetermined tolerance from saidtarget frame size.
 9. The set of instructions of claim 7 wherein in saidadjusting step, the target bit rate is adjusted if the current framesize is within a predetermined tolerance from said target frame size andat least one of a current frame rate is within a predetermined tolerancefrom said target frame rate and the ability of the processor to compressvideo frames to the target frame size at a target frame rate.
 10. A setof instructions residing in a storage medium, said set of instructionscapable of being executed by a processor to implement a method forcontrolling a video image compression system, the method comprising:compressing a video frame of raw video image data; determining a targetframe size based on a target bit rate for said video image compressionsystem; determining an outstanding byte count value related to a numberof bytes of compressed video image data to be transmitted from saidvideo image compression system; comparing a current frame size with saidtarget frame size; comparing an average frame rate for the video imagecompression system to a target frame rate for the video imagecompression system; and adjusting the target bit rate for said videoimage compression based on said comparisons.
 11. The set of instructionsof claim 10 wherein in said adjusting, the target bit rate is adjustedif the outstanding byte count is greater than zero and the current framesize is within a predetermined tolerance from said target frame size.12. The set of instructions of claim 11 wherein in said adjusting thetarget bit rate is adjusted if the current frame size is within apredetermined tolerance from said target frame size and at least one ofa current frame rate is not within a predetermined tolerance from saidtarget frame rate and the ability of the processor to compress videoframes to the target frame size at a target frame rate.
 13. A videoimage compression system, comprising: a bit rate controller to compressa video frame of raw video image data; a video controller coupled tosaid bit rate controller to determine a target frame size based on atarget bit rate for said video image compression system and anoutstanding byte count value related to a number of bytes of compressedvideo image data to be transmitted from said video image compressionsystem, said video controller to compare a current frame size with saidtarget frame size and adjust the target bit rate for said video imagecompression based on said comparison.
 14. The system of claim 13 whereinsaid video controller adjusts the target bit rate if the outstandingbyte count is zero and the current frame size is within a predeterminedtolerance from said target frame size.
 15. The system of claim 14wherein said video controller adjusts the target bit rate if the currentframe size is within a predetermined tolerance from said target framesize and at least one of a current frame rate is within a predeterminedtolerance from said target frame rate and the ability of the processorto compress video frames to the target frame size at a target framerate.
 16. A video image compression system comprising: a bit ratecontroller to compress a video frame of raw video image data; a videocontroller coupled to said bit rate controller to determine a targetframe size based on a target bit rate for said video image compressionsystem and an outstanding byte count value related to a number of bytesof compressed video image data to be transmitted from said video imagecompression system; said video controller to compare a current framesize with said target frame size and to compare an average frame ratefor the video image compression system to a target frame rate for thevideo image compression system, said video controller to adjust thetarget bit rate for said video image compression based on saidcomparisons.
 17. The system of claim 16 wherein the target bit rate isadjusted if the outstanding byte count is greater than zero and thecurrent frame size is within a predetermined tolerance from said targetframe size.
 18. The system of claim 17 wherein the target bit rate isadjusted if the current frame size is within a predetermined tolerancefrom said target frame size and at least one of a current frame rate isnot within a predetermined tolerance from said target frame rate and theability of the processor to compress video frames to the target framesize at a target frame rate.